using System;

namespace VSTalk.Tools
{
    /// <summary>
    /// Provides pub/sub mechanism. 
    /// </summary>
    public interface IEventAggregator
    {
        /// <summary>
        /// Publishes specific event.
        /// </summary>
        /// <typeparam name="TEvent">Event type.</typeparam>
        /// <param name="sampleEvent">Event obj.</param>
        void Publish<TEvent>(TEvent sampleEvent);
        
        /// <summary>
        /// Subscribes to specific event.
        /// </summary>
        /// <remarks>
        /// Use Dispose method for unsubscribe.
        /// </remarks>
        /// <typeparam name="TEvent">Event type.</typeparam>
        /// <returns>Event listener.</returns>
        IObservable<TEvent> GetEvent<TEvent>();
    }
}